export default {
  state: {
    count: 0,
    countN: 0,
  },
  getters: {
    doubleCount(state) {
      return state.count * 2;
    },
  },
  mutations: {
    increase(state) {
      state.count++;
    },
    decrease(state) {
      state.count--;
    },
    increaseByN(state, payload) {
      state.countN += payload;
    },
    decreaseByN(state, payload) {
      state.countN -= payload;
    },
  },
  actions: {
    delayAdd(context) {
      setTimeout(function () {
        context.commit("increase");
      }, 2000);
    },
    delayDec(context) {
      setTimeout(() => {
        context.commit("decrease");
      }, 2000);
    },
  },
};
